home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 25
/
AMIGAplus Sonderheft 25 (2000)(Falke)(DE)(Track 1 of 4)[!].iso
/
Updates
/
HD-Installer
/
jst_dev
/
sources
/
jst
/
gp_macros.i
next >
Wrap
Text File
|
2000-04-12
|
17KB
|
622 lines
IFND GP_MACROS_I_INCLUDED
GP_MACROS_I_INCLUDED = 1
include "osemu.i"
MC68000
; ** currently used disk sizes
STD_DISK_SIZE = 901120 ; standard dos copiable disks
B12_DISK_SIZE = 970752 ; 12 sectored 79 tracks disks, dos bootblock
S12_DISK_SIZE = 983040 ; 12 sectored 79 tracks disks, dos bootblock
; ** Tooltype/argument definitions
; bits
AFB_NTSC = 0
AFB_LOWMEM = 1
AFB_HDLOAD = 2
AFB_TRAINER = 3
AFB_NOOSSWAP = 4
AFB_JOYPAD = 5
; ** joypad button definitions (for JoyButtonsState)
; ** masks
AFF_FIRE1 = $20 ; red joypad button
AFF_START = $01 ; start/pause joypad button
AFF_FIRE2 = $40 ; blue joypad button
AFF_FIRE4 = $08 ; green joypad button
AFF_FIRE3 = $10 ; yellow joypad button
AFF_FORWD = $04 ; forward joypad key
AFF_BACWD = $02 ; back joypad key
; ** bits
AFB_START = $0 ; start/pause joypad button
AFB_BACWD = $1 ; back joypad key
AFB_FORWD = $2 ; forward joypad key
AFB_FIRE4 = $3 ; green joypad button
AFB_FIRE3 = $4 ; yellow joypad button
AFB_FIRE1 = $5 ; red joypad button
AFB_FIRE2 = $6 ; blue joypad button
STORE_REGS: MACRO
IFLE NARG
movem.l D0-D7/A0-A6,-(A7)
ELSE
movem.l \1,-(A7)
ENDC
ENDM
RESTORE_REGS: MACRO
IFLE NARG
movem.l (A7)+,D0-D7/A0-A6
ELSE
movem.l (A7)+,\1
ENDC
ENDM
WAIT_LMB: MACRO
.wl\@
btst #6,$BFE001
bne .wl\@
ENDM
WAIT_JOY: MACRO
.wj\@
btst #7,$BFE001
bne .wj\@
ENDM
GETLVO:MACRO
move.l #_LVO\1,D0
ENDM
; ******* Print/Printf ********
; Because of buggy Barfly macro argument count,
; I had to make 2 functions for BARFLY for each Mac_printf and Mac_printh
;
; Mac_printf : same as before
; Mac_print : no linefeed (same as Mac_printf "string",*anything* , except
; Barfly does not work properly with it, and as I now use Barfly for JST
; it's annoying)
;
; Mac_printh : same as before
; Mac_printx : Mac_printh without linefeed
IFD BARFLY
Mac_print: MACRO
move.l A1,-(A7)
lea .text\@(PC),A1
JSRABS Display
bra .ftext\@
.text\@
dc.b "\1",0
even
.ftext\@
move.l (A7)+,A1
ENDM
Mac_printf: MACRO
Mac_print <\1>
NEWLINE
ENDM
Mac_printh: MACRO
Mac_printx \1
NEWLINE
ENDM
Mac_printx:MACRO
movem.l D0/A1,-(A7)
move.l \1,D0
lea .text\@(PC),A1
JSRABS HexToString
JSRABS Display
bra .ftext\@
.text\@
dc.b "$00000000",0
even
.ftext\@
movem.l (A7)+,D0/A1
ENDM
ELSE
; *** macro definitions for other assemblers than Barfly
; ******* Macro Printf ********
; Mac_printf "text" -> text + linefeed
; Mac_printf "text",*any argument* -> text without linefeed
Mac_printf: MACRO
move.l A1,-(A7)
lea .text\@(PC),A1
JSRABS Display
bra .ftext\@
.text\@
IFD MAXON_ASM
dc.b "\1"
ELSE
IFD BARFLY
;; dc.b "\1"
ELSE
DC.B \1
ENDIF
ENDIF
IFLE NARG-1
dc.b 10,13
ENDC
dc.b 0
even
.ftext\@
move.l (A7)+,A1
ENDM
Mac_print:MACRO
Mac_printf \1,v
ENDM
; ******* Macro Printh ********
; Mac_printh <expr> -> hex number + linefeed
; Mac_printh <expr>,*any argument* -> without linefeed
Mac_printh: MACRO
movem.l D0/A1,-(A7)
move.l \1,D0
lea .text\@(PC),A1
JSRABS HexToString
JSRABS Display
bra .ftext\@
.text\@
dc.b "$00000000"
IFLE NARG-1
dc.b 10,13
ENDC
dc.b 0
even
.ftext\@
movem.l (A7)+,D0/A1
ENDM
ENDC
PUTS: MACRO
move.l A1,-(A7)
lea \1,A1
JSRABS Display
move.l (A7)+,A1
ENDM
NEWLINE: MACRO
JSRABS NewLine
ENDM
STOP_SOUND:MACRO
move.w #$000F,dmacon+$DFF000
move.w #$0000,aud0+ac_len+$DFF000
move.w #$0000,aud1+ac_len+$DFF000
move.w #$0000,aud2+ac_len+$DFF000
move.w #$0000,aud3+ac_len+$DFF000
ENDM
MAKE_ABS_REFS:MACRO
; *** Non-relocated routines. call normally with JSR
; *** don't call them with JSRGEN, this would not compile (better than crash)
DEF_\1_ABS CloseAll,0 ; quit program (while the OS is up)
DEF_\1_ABS CloseAllQuiet,1 ; quit program and close window
DEF_\1_ABS LoadDisks,2 ; load diskfiles
DEF_\1_ABS LoadDiskFromName,3 ; load a disk
DEF_\1_ABS LoadDisksIndex,4 ; load a disk, starting from number D0
DEF_\1_ABS LoadFiles,5 ; load files in the directory
DEF_\1_ABS LoadSmallFiles,6 ; load small files (<D0)
DEF_\1_ABS Kick37Test,7 ; check if Kickstart version <37
DEF_\1_ABS KickVerTest,8 ; check against a given kick version
DEF_\1_ABS GetMemFlag,9 ; returns MEMF_REVERSE flag isf available
DEF_\1_ABS FlushCachesSys,10 ; flush caches using CacheClearU()
DEF_\1_ABS Enhance,11 ; restores everything (caches, display)
DEF_\1_ABS Degrade,12 ; degrades everything
DEF_\1_ABS DegradeCpu,13 ; degrades only CPU related stuff
DEF_\1_ABS DegradeGfx,14 ; degrades only GFX related stuff
DEF_\1_ABS TransfRoutines,15 ; *** obsolete ***
DEF_\1_ABS SaveOSData,16 ; saves OS data (mem,CIAs,custom...)
DEF_\1_ABS TestFile,17 ; check if a file is here (game path)
DEF_\1_ABS Display,18 ; display a string pointed by A1
DEF_\1_ABS LoadRNCFile,19 ; load a RNC file and unpack it
DEF_\1_ABS AllocExtMem,20 ; allocate extension memory
DEF_\1_ABS Test1MBChip,21 ; check against 1MB of chip (at least)
DEF_\1_ABS Test2MBChip,22 ; check against 2MB of chip
DEF_\1_ABS Reboot,23 ; reboots :-), only works when OS is alive!
DEF_\1_ABS WaitReturn,24 ; waits for the user to press return key
DEF_\1_ABS BlockFastMem,25 ; * allocates all fastmem. Do not use :-)
DEF_\1_ABS CheckFastMem,26 ; checks if the computer has got fast memory
DEF_\1_ABS SupervisorMode,27 ; goes into supervisor mode
DEF_\1_ABS UserMode,28 ; goes into user mode
DEF_\1_ABS Alloc24BitMem,29 ; allocate extension memory, 24 bit area only
DEF_\1_ABS OpenFakeExec,30 ; allocate table for fake exec
DEF_\1_ABS SetFilesPath,31 ; change default file path
DEF_\1_ABS TestDirectory,32 ; test directory presence (game path)
DEF_\1_ABS TestDirectoryAbs,33 ; test directory presence (absolute path)
DEF_\1_ABS TestFileAbs,34 ; test file presence (absolute path)
DEF_\1_ABS SetLocalVarZone,35 ; save start-end of local object variables
DEF_\1_ABS InitLogPatch,36 ; initialize patch logging (private function)
DEF_\1_ABS TestAssign,37 ; test assign presence
DEF_\1_ABS AllocateTheMemory,38 ; AllocMem with ressource-tracking
DEF_\1_ABS FreeTheMemory,39 ; AllocMem with ressource-tracking
DEF_\1_ABS HexToString,40 ; HexToString, absolute call
DEF_\1_ABS UseHarryOSEmu,41 ; Tell JST to use Harry's great OS emu
DEF_\1_ABS NewLine,42 ; Prints a newline
DEF_\1_ABS DisableChipmemGap,43 ; Will allow LOWMEM with 2MB chip
DEF_\1_ABS GetFileLength,44 ; Returns the length of a file on disk
DEF_\1_ABS CloseAllWithError,45 ; internal - do not use
DEF_\1_ABS LogChipMirror,46 ; internal - do not use
DEF_\1_ABS LogCustomMirror,47 ; internal - do not use
DEF_\1_ABS LogExtMemory,48 ; internal - do not use
DEF_\1_ABS LogRegisters,49 ; internal - do not use
DEF_\1_ABS DisableMMU,50 ; internal - do not use
DEF_\1_ABS SetClockLoad,51 ; internal - do not use
DEF_\1_ABS Unsupported2,52 ; future use
DEF_\1_ABS Unsupported3,53 ; future use
DEF_\1_ABS Unsupported4,54 ; future use
DEF_\1_ABS Unsupported5,55 ; future use
DEF_\1_ABS Unsupported6,56 ; future use
DEF_\1_ABS Unsupported7,57 ; future use
DEF_\1_ABS Unsupported8,58 ; future use
ENDM
; *** Relocated routines. always call with JSRGEN (see macros.i)
; *** from user program. It works with JSR but if the OS is killed
; *** JSRGEN is safer as it jumps in the allocated block
; *** which is in the top of memory (MEMF_REVERSE) if kick > 38
; *** fast memory is used when found, else chipmem is used
; ***
; *** I also included a short description of the routines
; *** Please read the autodocs to get more details
; *** The functions marked with a * should not be used anymore
MAKE_REL_REFS:MACRO
DEF_\1_REL GetSR,0 ; returns SR in D0
DEF_\1_REL GoECS,1 ; resets sprite aspect/playfield/goes 15KHz (dummy)
DEF_\1_REL GetAttnFlags,2 ; gets system backuped AttnFlags, at any time
DEF_\1_REL ResetDisplay,3 ; switches in PAL or NTSC if specified
DEF_\1_REL ResetSprites,4 ; resets sprite aspect, useless, dummy!
DEF_\1_REL BlackScreen,5 ; sets all color registers to black
DEF_\1_REL JoypadState,6 ; to check the state of joystick/joypad
DEF_\1_REL InitTrackDisk,7 ; returns a fake disk IO pointer in A1
DEF_\1_REL TrackLoad,8 ; simulates DoIO()
DEF_\1_REL TrackLoadFast,9 ; *